<?php
/*
*All rights reserved: Json.
*Links:http://www.liyaoquan.cn.
*Links:http://imarkchina.cn.
*Links:http://www.imarkchina.cn.
*/

/**
 * 博客后台评论控制器，负责，业务流程判断
 * 后台所有操作都需要权限，必需继承 CommonAction 控制器
 */
Class GetpinglunAction extends CommonAction{

	/**
	 * 评论首页
	 * @return [type] [description]
	 */
	Public function index(){
		$M = M('Getpinglun')->Show();
		$this->assign('pinglun', $M['pinglun']);
		$this->assign('page', $M['page']);
		$this->assign('fix', (C('URLREWRITE')) ? C('URLSPACE') : '&');
		$this->display();
	}

	/**
	 * 删除评论操作
	 * @return [type] [description]
	 */
	Public function delpinglun(){
		if (M('Getpinglun')->deletePingLun(G('get.fileid'), G('get.id'))) {
			$this->success('删除成功～！', U('index'));
		} else {
			$this->error('删除失败～！');
		}
	}

	/**
	 * 回复评论操作
	 * @return [type] [description]
	 */
	Public function replay(){
		if (ISPOST) {
			if (M('Getpinglun')->savePunLun(G('post.'))) {
				$this->success('回复评论成功～！', U('index'));
			} else {
				$this->error('回复评论失败～！');
			}
		}
	}
}